<template>
  <div class="detail-enterprise">
    <header class="add-header">
      <el-page-header content="查看详情" @back="$router.back()" />
    </header>
    <main class="add-main">
      <div class="form-container">
        <div class="title">车辆信息</div>
        <el-form v-model="carList">
          <el-row :gutter="20">
            <el-col :span="6" :offset="3"><div class="grid-content bg-purple" />
              <el-form-item label="车主姓名">
                <span>{{ carList.personName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6" :offset="3"><div class="grid-content bg-purple-light" />
              <el-form-item label="联系方式">
                <span>{{ carList.phoneNumber }}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6" :offset="3"><div class="grid-content bg-purple" />
              <el-form-item label="车牌号码">
                <span>{{ carList.carNumber }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6" :offset="3"><div class="grid-content bg-purple-light" />
              <el-form-item label="车辆品牌">
                <span>{{ carList.carBrand }}</span>
              </el-form-item>
            </el-col>
          </el-row>

        </el-form>
      </div>
    </main>
    <main class="add-main">
      <div class="form-container">
        <div class="title">月卡缴费记录</div>
        <div class="table-container">
          <el-table
            :data="MonthCardForm"
            style="width: 100%"
            border
          >
            <el-table-column
              type="index"
              label="序号"
              width="80"
            />
            <el-table-column
              label="有效时间"
              width="280"
            >
              <template #default="{row}">
                {{ row.cardStartDate }} - {{ row.cardEndDate }}
              </template>
            </el-table-column>
            <el-table-column
              prop="paymentAmount"
              label="支付金额"
              width="120"
            />
            <el-table-column
              prop="paymentMethod"
              label="支付方式"
              width="150"
            >
              <template #default="scope">
                {{ payMethodObj[scope.row.paymentMethod] }}
              </template>
            </el-table-column>
            <el-table-column
              prop="createTime"
              label="办理时间"
            />
            <el-table-column
              prop="createUser"
              label="办理人"
              width="80"
            />
          </el-table>
        </div>

      </div>
    </main>

  </div>
</template>

<script>
import { viewMonthCardAPI } from '@/apis/car'
export default {
  data() {
    return {
      // cardStartDate: '',
      //   cardEndDate: '',
      //   createTime: '',
      //   paymentAmount: '',
      //   paymentMethod: '',
      //   createUser: ''
      carList: [],
      MonthCardForm: [],
      // 支付方式列表
      payMethodObj: {
        Alipay: '支付宝',
        WeChat: '微信',
        Cash: '线下'
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList() {
      const res = await viewMonthCardAPI(this.$route.query.id)
      console.log(res)
      this.carList = res.data
      console.log(this.carList)
      this.MonthCardForm = res.data.rechargeList
    }
  }
}
</script>

<style scoped lang="scss">
.detail-enterprise {
  background-color: #f4f6f8;
  height: 100vh;

  .add-header {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 64px;
    background-color: #fff;

    .left {
      span {
        margin-right: 4px;
      }
      .arrow{
        cursor: pointer;
      }
    }

    .right {
      text-align: right;
    }
  }

  .add-main {
    background: #f4f6f8;
    padding: 20px 130px;

    .form-container {
      background-color: #fff;
      margin-bottom: 20px;
      .title {
        height: 60px;
        line-height: 60px;
        padding-left: 20px;
      }
    }
    .table-container{
      padding:20px;
    }
    .preview{
      img{
        width: 100px;
      }
    }
  }
}
</style>
